import request from "@/utils/ajax.js"

//获取联想建议
export const getSuggestion_api = (q) => {
  return request({
    url: '/app/v1_0/suggestion',
    method: 'get',
    params: {
      q
    }
  })
}
//获取搜索结果-----------------
export const getResults_api = (params) => {
  return request({
    url: '/app/v1_0/search',
    method: 'get',
    params
  })
}
//获取新闻文章详情----------------------------
export const getAticles_api = (id) => {
  return request({
    url: `/app/v1_0/articles/${id}`,
    method: 'get'
  })
}
//关注用户-----------------------------
export const follwedUser_api=(target)=> {
  return request({
    url:'/app/v1_0/user/followings',
    method:'post',
    data:target    //被关注用户id
  })
}
//取消用户关注--------------------------
export const delFollwedUser_api=(target)=> {
  return request({
    url:'/app/v1_0/user/followings/'+target,
    method:'DELETE',
  })
}
//收藏文章---------------------------------
export const getCollected_api=(target)=> {
  return request({
    url:'/app/v1_0/article/collections',
    method:"post",
    data:{
      target
    }
  })
}
//取消收藏----------------------------------
export const delCollected_api=(target)=> {
  return request({
    url:'app/v1_0/article/collections/'+target,
    method:'delete'
  })
}

